<div id="main_block">
<h1><?php echo $user->name; ?></h1>
<p><?php echo str_replace("\n", "<br/>", $user->info); ?></p>
<table class="data_table">
<tr>
  <td style="font-weight:bold;">Full name: </td>
  <td><?php echo $user->name; ?></td>
</tr>
<tr>
  <td style="font-weight:bold;">Member since: </td>
  <td><?php echo $user->date_joined; ?></td>
</tr>
<?php if($user->address) { ?>
<tr>
  <td style="font-weight:bold;">Address: </td>
  <td><?php echo $user->address; ?></td>
</tr>
<?php } ?>
<tr>
  <td style="font-weight:bold;">Username: </td>
  <td><?php echo $user->username; ?></td>
</tr>
<tr>
  <td style="font-weight:bold;">Articles written: </td>
  <td><?php echo count($user->articles()); ?></td>
</tr>
<?php if($user->roles()) { ?>
<tr>
  <td style="font-weight:bold;">Representing: </td>
  <td>
      <?php 
      foreach($user->roles() as $role) 
              {
                echo '<div><a href="'. site_url('profile/org/'.$role->organization->idorganization ).'">';
                echo $role->organization->name . '</a>';
                echo ' as ' . $role->role;
                echo '</div>';
               }
       ?>
  </td>
</tr>
<?php } ?>
<?php if(count($user->articles())>0) {?>
<tr>
  <td style="font-weight:bold;">Articles by <?php echo $user->name; ?>: </td>
  <td></td>
</tr>
</table>
<?php foreach($user->articles() as $article):?>
<?php echo $article->info(false, false, true, true, true, false);?>
<?php endforeach; } else {?>
<tr>
  <td style="font-weight:bold;"><?php echo $user->name; ?> has not written any articles.</td>
  <td></td>
</tr>
</table>
<?php } ?>


</div>